package net.wanho.servlet;

import net.wanho.entity.User;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Date;
import java.util.List;

/**
 * Author：汤小洋
 * Date：2024-07-26 17:25
 * Description：<描述>
 */
@WebServlet("/list")
public class UserServlet extends HttpServlet {

    // private UserService userService = new UserSerivceImpl();

    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        // List<User> users =  userService.findAll();

        resp.setContentType("text/html;charset=utf8");
        PrintWriter out = resp.getWriter();

        out.print("<table>");
        out.print(" <tr>");
        out.print("     <td>id</td>");
        out.print("     <td>name</td>");
        out.print("     <td>age</td>");
        out.print("     <td>sex</td>");
        out.print(" </tr>");
        // for (User user : users) {
        //     out.print(" <tr>");
        //     out.print("     <td>" + user.getId() + "</td>");
        //     out.print("     <td>" + user.getName() + "</td>");
        //     out.print("     <td>" + user.getAge() + "</td>");
        //     out.print("     <td>" + user.getSex() + "</td>");
        //     out.print(" </tr>");
        // }
        out.print("</table>");

        User user = new User();
        System.out.println(user.getName());

        out.close();
    }
}
